﻿/*---------------------------------------------------------------------------------
-----------------***DaLianQianYi***-----------------------
-----------------作者：大连仟亿科技------------------------------------------------------
-----------------联系作者：www.qianyikeji.com----------------------------------
-----------------时间：2024/7/15 14:05:13------------------------------------------
----------------------------------------------------------------------------------*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Donal.Xms.BLL
{
    /// <summary>
    ///数据业务层
    /// </summary>
    public partial class spec_prices
    {
        private readonly Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig();//获得系统配置信息
        private readonly DAL.spec_prices dal;

        public spec_prices()
        {
            dal = new DAL.spec_prices(sysConfig.sysdatabaseprefix);
        }

        #region 基本方法================================
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            return dal.Exists(id);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.spec_prices model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.spec_prices model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            return dal.Delete(id);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.spec_prices GetModel(int id)
        {
            return dal.GetModel(id);
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }

        /// <summary>
        /// 获得查询分页数据
        /// </summary>
        public DataSet GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
        {
            return dal.GetList(pageSize, pageIndex, strWhere, filedOrder, out recordCount);
        }
        #endregion

        #region 扩展方法================================

        /// <summary>
        /// 获得查询分页数据
        /// </summary>
        public DataSet GetListView(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
        {
            return dal.GetListView(pageSize, pageIndex, strWhere, filedOrder, out recordCount);
        }

        /// <summary>
        /// 返回指定列
        /// </summary>
        public string GetValue(int id, string fileName)
        {
            return dal.GetValue(id, fileName);
        }

        /// <summary>
        /// 修改一列数据
        /// </summary>
        public bool UpdateField(int id, string strValue)
        {
            return dal.UpdateField(id, strValue);
        }

        /// <summary>
        /// 获取差异价格
        /// 1、规格--固定价格--会员
        /// 2、规格--固定价格--组别
        /// 3、规格--百分比--会员
        /// 4、规格--百分比--组别
        /// 5、商品--百分比--会员（商品无法设置固定价）
        /// 6、商品--百分比--组别（商品无法设置固定价）
        /// 7、品类--百分比--会员（品类无法设置固定价）
        /// 8、品类--百分比--组别（品类无法设置固定价）
        /// 9、会员组别--百分比
        /// 10、游客或登录--百分比（显示价格时）
        /// </summary>
        /// <param name="company_name">会员用户名</param>
        /// <param name="product_title">商品名称</param>
        /// <param name="group_name">会员组别名称</param>
        /// <param name="groupDiscount">会员组别中定义的折扣百分比</param>
        /// <param name="goods_title">规格名称</param>
        /// <param name="discount_remark">返回折扣规格</param>
        /// <param name="category_title">品类名称</param>
        /// <param name="categoryId">品类ID</param>
        /// <param name="productId">商品ID</param>
        /// <param name="goodsId">规格ID</param>
        /// <param name="is_member">是否为会员</param>
        /// <param name="orgPrice">商品原价</param>
        /// <param name="userGroupId">会员或个人组别ID</param>
        /// <param name="companyId">会员ID</param>
        public decimal GetSpecPrice(bool is_member, int goodsId, string goods_title, int productId, string product_title, int categoryId, string category_title, int companyId, string company_name, int userGroupId, string group_name, decimal groupDiscount, decimal orgPrice, out string discount_remark)
        {
            return dal.GetSpecPrice(is_member, goodsId, goods_title, productId, product_title, categoryId, category_title, companyId, company_name, userGroupId, group_name, groupDiscount, orgPrice, out discount_remark);
        }
        #endregion
    }
}


